#include  <cstdio>

int main(int argc, char *argv[])
{
	int n;
	printf("PERFECTION OUTPUT\n");
	while( scanf("%d",&n) && n != 0 )
	{
		int sum = 0;
		for( int i = 1; i <= n/2 ; ++i )
			if(n%i == 0)
				sum += i;

		if(sum == n)
			printf("%5d  PERFECT\n",n);
		else if(sum < n)
			printf("%5d  DEFICIENT\n",n);
		else
			printf("%5d  ABUNDANT\n",n);
		
	}
	printf("END OF OUTPUT\n");
}
